<?php

header("Content-type: image/png");

$img = imagecreate(31,31);
imagecolorallocate($img, 0x9B, 0xA0, 0xBC);
if(!isset($_GET['gray']))
{
	$green = imagecolorallocate($img, 0, 200, 0);
	$red = imagecolorallocate($img, 0xD0, 0x12, 0x12);
}
else
{
	$green = imagecolorallocate($img, 0x99, 0x99, 0x99);
	$red = imagecolorallocate($img, 0x55, 0x55, 0x55);
}
$white = imagecolorallocate($img, 0xFF, 0xFF, 0xFF);

if(isset($_GET['a']) && is_numeric($_GET['a']))
{
	$angle = 360*$_GET['a']-90;
	$p = round($_GET['a']*100, 0);
}
else
{
	$angle = -90;
	$p = 0;
}
imagefilledarc($img, 16, 16, 30, 30, -90, $angle, $green, 0);
if($angle != 360-90)
	imagefilledarc($img, 16, 16, 30, 30, $angle, -90, $red, 0);
imagestring($img, 3, ($p>9?($p==100?7:10):14), 9, $p, $white);
imagepng($img);
imagedestroy($img);
?>